'\" t
.\"
.\" Copyright (c) 2024 Ken McDonell.  All Rights Reserved.
.\"
.\" This program is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License as published by the
.\" Free Software Foundation; either version 2 of the License, or (at your
.\" option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful, but
.\" WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
.\" or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
.\" for more details.
.\"
.\"
.TH RUNASPCP 1 "PCP" "Performance Co-Pilot"
.SH NAME
\f3runaspcp\f1 \- execute a shell command as the user ``pcp''
.SH SYNOPSIS
.B $PCP_BINADM_DIR/runaspcp
[\f3\-D\f1 \f2debug\f1]
[\f3\-s\f1 \f2shell\f1]
command
.SH DESCRIPTION
.B runaspcp
runs the single argument
.I command
as the user
.B $PCP_USER
and group
.B $PCP_GROUP
(both from
.IR /etc/pcp.conf ).
.PP
The
.I command
is run by
.BR sh (1)
by default, else
.I shell
from the
.B \-s
(or
.BR \-\-shell)
command line argument.
.PP
Normally
.B runaspcp
is used from the PCP ``init'' scripts that are launched
as ``root'' but need to downgrade their privileges when running
some PCP daemons as the ``pcp'' user.
.PP
The \fB\-?\fR, \fB\-\-help\fR
option displays a usage message.
.SH DIAGNOSTICS
The exit status is 1 if
.B runaspcp
cannot change user or group, or cannot execute the shell,
else the exit status of
.IR command .
.SH PCP ENVIRONMENT
Environment variables with the prefix \fBPCP_\fP are used to parameterize
the file and directory names used by PCP.
On each installation, the
file \fI/etc/pcp.conf\fP contains the local values for these variables.
The \fB$PCP_CONF\fP variable may be used to specify an alternative
configuration file, as described in \fBpcp.conf\fP(5).
.SH DEBUGGING OPTIONS
The
.B \-D
or
.B \-\-debug
option enables the output of additional diagnostics on
.I stderr
to help triage problems, although the information is sometimes cryptic and
primarily intended to provide guidance for developers rather end-users.
.I debug
is a comma separated list of debugging options; use
.BR pmdbg (1)
with the
.B \-l
option to obtain
a list of the available debugging options and their meaning.
.PP
Debugging options specific to
.B runaspcp
are as follows:
.TS
box;
lf(B) | lf(B)
lf(B) | lf(R) .
Option	Description
_
appl0	verbose diagnostics
.TE
